import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class exec {
	public static void main(String[] args) throws IOException {
		Process ps = Runtime.getRuntime().exec("/home/hsyeb/test/a.sh");
		// 取得命令结果的输出流
		InputStream is = ps.getInputStream();
		// 用一个读输出流类去读
		InputStreamReader isr = new InputStreamReader(is);
		// 用缓冲器读行
		BufferedReader br = new BufferedReader(isr);
		String line = null;
		StringBuffer sb = new StringBuffer();
		while ((line = br.readLine()) != null) {
			System.out.println(line);
			sb.append(line);
		}
		is.close();
		isr.close();
		br.close();
		System.out.println(sb.toString());
	}
}
